<?
    /* -*- Mode: PHP5; tab-width: 4; indent-tabs-mode: nil; basic-offset: 4 -*- */
    
    /*********************************************************
    *            --== InArch ==--
    *
    * This is the key class to all the admin side data nodes.
    * It is extended into child classes which do all the work.
    *
    * @author Kulikov Alexey <a.kulikov@gmail.com>
    * @version n/a
    * @since 25.05.2005
    * @copyright essentialmind.com 2005
    *
    *********************************************************/
    
    /***
    * Class adminNodePage
    ****
    * This class handles the editing of simple HTML pages in INA
    ****
    * @package adminNodes
    * @author tb@essentialmind.com
    * @version n/a
    * @since 13.07.2011
    * @copyright essentialmind.com 2011
    ***/
    class adminNodeExtensibleFormRecord extends adminNode{
        
        function process(){
            if($_POST){
				$this->update();                
			}else{   
				$this->show();
			}
        }
        
        
        protected function show() {

			$record = $this->db->getRow("SELECT pagemap.title, pagemap.nodeid, nefr.*
										FROM pagemap
										LEFT JOIN node_extensible_form_record nefr 
											ON pagemap.pageid = nefr.id 
										WHERE pagemap.id = " . $this->pageref);					

			$record['array_data'] = unserialize($record['xml_content']);
			$this->smarty->assign('record', $record);
		}
        
        protected function update() {
        
        }
        
        
        /**
         * Will set the HTML template needed for
         * the child's operation
         * 
         * @return 
         **/
        function setTemplate(){
            $this->setActionTemplate('nodes/showExtensibleFormRecord.html');
        }
        
        
		/** 
         * method which will handle a default add action to the
         * dedicated table
         * 
         * @return integer ID of new object
         * @see ajaxAddPage
         * @see ajaxAddNode
         **/
        function addInstance(){
            $this->db->Execute("INSERT INTO node_page(content) VALUES('')");
            return $this->db->getOne("SELECT last_value FROM node_page_id_seq");
        }
    }
?>